import request from "@/utils/request";

export const productNameService=(name)=>{
    const params = new URLSearchParams();
    params.append("name", name);
    return request.post('/home/name',params);
}

export const productInfoByNameService=(name)=>{
    const params = new URLSearchParams();
    params.append("name", name);
    return request.post('/home/info',params);
}

export const productInsertService=(productInfo)=>{
    const product = new URLSearchParams();
    for (let key in productInfo) {
        product.append(key, productInfo[key]);
    }

    return request.post('/backend/product',product);
}

export const deleteProductService=(id)=>{

    return request.delete('/backend/product?id='+id);
}
export const upProductInfoService=(productInfo)=>{
    const product = new URLSearchParams();
    for (let key in productInfo) {
        product.append(key, productInfo[key]);
    }
    return request.post('/backend/product/update',product);
}